package com.self.common.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @version v1.0
 * @ClassName: SnowFlakeConfig
 * @Description:
 * @Author: Mac
 * @Date: 2022/6/5 15:35
 */
@Configuration
public class SnowFlakeConfig {

    @Value("${snowFlake.workerId:1}")
    private Long workerId;
    @Value("${snowFlake.dataCenterId:1}")
    private Long dataCenterId;

    @Bean
    public Snowflake snowFlake(){
        return new Snowflake(workerId,dataCenterId);
    }
}
